<%@ page contentType="text/html; charset=UTF-8"%>
<%@ include file="/WEB-INF/view/system/common/head.jsp"%>
<script type="text/javascript">
<!--
$(document).ready(function() {
	setDataGridList();
});
var userStateListJSON = eval('(${userStateListJSON})');
var empStateListJSON = eval('(${empStateListJSON})');
//查询列表初始化
function setDataGridList() {
	$('#userDataGrid').datagrid({
		url:'getUserListByGroupId.action?groupId=${group.id}',
		title:"分组用户列表",
		fitColumns:true,nowrap:false,rownumbers:true,showFooter:false,pagination:false,striped:true,singleSelect:true,
		idField:'id',
		frozenColumns:[[{field:'ck',checkbox:true}]],
		tools: [{iconCls: 'icon-reload',handler: function(){$('#userDataGrid').datagrid('reload');unSelectAll();}}],
		columns:[[{field:'id',width:10,hidden:true,sortable:true}
			,{field:'code',title:"工号",width:10,sortable:true}
			,{field:'name',title:"姓名",width:20,sortable:true}
			,{field:'rolename',title:"角色",width:15,sortable:true}
			,{field:'groupname',title:"所属分组",width:20,sortable:true}
			,{field:'empstate',title:"在职状态",width:20,sortable:true,formatter:function(val){return empStateListJSON[val].peizhiKey;}}
			,{field:'userstate',title:"用户状态",width:20,sortable:true,formatter:function(val){return userStateListJSON[val].peizhiKey;}}
			]]
		,onDblClickRow: function (rowIndex, rowData) {goUserDetail(rowData);}  
		,onSelect:function(row){
			parent.$('#groupTreegrid').treegrid('unselectAll');
			
			//var selecteds = $('#userDataGrid').datagrid('getSelections');
			//for(var i = 0 ;i<selecteds.length;i++){
			//	if(selecteds[i].id!=row.id){
			//		$('#userDataGrid').datagrid('unselect',selecteds[i].id);
			//	}
			//}
		}
	});
}
function goUserDetail(row){
	addTab('用户详情', encodeURI(encodeURI('goUserDetail.action?operatorUserId='+row.id)), '#tt', "parent.parent");
}
function unSelectAll(){
	$('#userDataGrid').datagrid('unselectAll');
}
function getSelectUser(){
	return $('#userDataGrid').datagrid('getSelected');
}
//-->
</script>
<body>
	<table id="userDataGrid">
	</table>
</body>
</html>